//服务器全部接口返回的数据类型
export interface ResponseData {
  code: number
  msg: string
  ok: boolean
}
//spu数据的ts类型
export interface SpuData {
  id?: number //新增不需要
  spuName: string
  description: string //spu描述
  category3Id: number | string
  tmId: number | string //品牌id
  spuSaleAttrList: null | SaleAttr[] //销售属性
  spuImageList: null | SpuImage[] //商品图片
}
export type Records = SpuData[]
//已有spu返回的ts类型
export interface HasSpuResponseData extends ResponseData {
  data: {
    records: Records
    total: number
    size: number
    current: number
    searchCount: boolean
    pages: number
  }
}
//品牌数据的ts类型
export interface Trademark {
  id: number
  tmName: string
  logoUrl: string
}
//品牌接口返回的数据类型
export interface AllTrademark extends ResponseData {
  data: Trademark[]
}

//商品图片的ts类型
export interface SpuImage {
  id?: number
  spuId?: number
  imgName?: string
  imgUrl?: string
  name?: string
  url?: string
}
//商品图片接口返回的数据类型
export interface SpuImageRes extends ResponseData {
  data: SpuImage[]
}
//已有销售属性值对象的ts类型
export interface SaleAttrValue {
  id?: number
  spuId?: number
  baseSaleAttrId: number
  saleAttrValueName: string
  saleAttrName?: string
  isChecked?: boolean | null
}
export type spuSaleAttrValueList = SaleAttrValue[]

//销售属性的ts类型
export interface SaleAttr {
  id?: number
  spuId?: number
  baseSaleAttrId: number | string
  saleAttrName: string
  spuSaleAttrValueList: SaleAttrValue[]
  flag?: boolean
  saleAttrValue?: string
}
//spu已有的销售属性接口返回的数据类型
export interface SpuSaleAttrRes extends ResponseData {
  data: SaleAttr[]
}
//全部销售属性
export interface ASaleAttr {
  id: number
  name: string
}
//获取整个项目全部的销售属性接口返回的数据类型
export interface AllSaleAttrRes extends ResponseData {
  data: ASaleAttr[]
}

export interface Attr {
  attrId: number | string //平台属性的ID
  valueId: number | string //属性值的ID
}

export interface saleArr {
  saleAttrId: number | string //属性ID
  saleAttrValueId: number | string //属性值的ID
}
export interface SkuData {
  category3Id: string | number //三级分类的ID
  spuId: string | number //已有的SPU的ID
  tmId: string | number //SPU品牌的ID
  skuName: string //sku名字
  price: string | number //sku价格
  weight: string | number //sku重量
  skuDesc: string //sku的描述
  skuAttrValueList?: Attr[]
  skuSaleAttrValueList?: saleArr[]
  skuDefaultImg: string //sku图片地址
}

//获取SKU数据接口的ts类型
export interface SkuInfoData extends ResponseData {
  data: SkuData[]
}
